/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    width: 100vw;
    height: 100vh;
    font-family: 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
    background: transparent;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 背包容器 - 魔兽争霸风格 */
.backpack-container {
    background: linear-gradient(135deg, #3d2817 0%, #5a3d28 50%, #3d2817 100%);
    border: 3px solid #8b6914;
    border-radius: 8px;
    box-shadow: 
        inset 0 0 20px rgba(0, 0, 0, 0.5),
        0 10px 40px rgba(0, 0, 0, 0.8);
    min-width: 600px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
}

/* 背包头部 */
.backpack-header {
    background: linear-gradient(180deg, #5a3d28 0%, #3d2817 100%);
    border-bottom: 2px solid #8b6914;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: inset 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.backpack-title {
    color: #f4d03f;
    font-size: 22px;
    font-weight: bold;
    text-shadow: 
        1px 1px 2px rgba(0, 0, 0, 0.8),
        0 0 10px rgba(244, 208, 63, 0.3);
    letter-spacing: 1px;
}

.close-btn {
    width: 32px;
    height: 32px;
    border: 2px solid #8b6914;
    background: linear-gradient(180deg, #8b6914 0%, #6d5210 100%);
    color: #f4d03f;
    font-size: 24px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 
        inset 0 1px 2px rgba(255, 255, 255, 0.2),
        0 2px 4px rgba(0, 0, 0, 0.4);
    line-height: 1;
}

.close-btn:hover {
    background: linear-gradient(180deg, #a67c1a 0%, #8b6914 100%);
    transform: scale(1.1);
    box-shadow: 
        inset 0 1px 2px rgba(255, 255, 255, 0.3),
        0 3px 6px rgba(0, 0, 0, 0.5);
}

.close-btn:active {
    transform: scale(0.95);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* 背包主体 */
.backpack-body {
    padding: 20px;
    max-height: calc(90vh - 70px);
    overflow-y: auto;
}

/* 背包网格 */
.backpack-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

/* 物品槽位 - 魔兽争霸风格 */
.item-slot {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #2a1f15 0%, #1a130d 100%);
    border: 2px solid #5a4528;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 
        inset 0 0 10px rgba(0, 0, 0, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

/* 稀有度边框与动态特效 */
.item-slot.rarity-white {
    border-color: #cfcfcf;
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.05), 0 0 0 rgba(255,255,255,0);
}

.item-slot.rarity-green {
    border-color: #2ecc71;
    animation: glowGreen 2s ease-in-out infinite;
}

.item-slot.rarity-purple {
    border-color: #9b59b6;
    animation: glowPurple 2.2s ease-in-out infinite;
}

.item-slot.rarity-gold {
    border-color: #f1c40f;
    animation: glowGold 2.4s ease-in-out infinite;
}

@keyframes glowGreen {
    0%, 100% { box-shadow: inset 0 0 10px rgba(0,0,0,0.5), 0 0 8px rgba(46, 204, 113, 0.15); }
    50% { box-shadow: inset 0 0 12px rgba(0,0,0,0.55), 0 0 16px rgba(46, 204, 113, 0.45); }
}

@keyframes glowPurple {
    0%, 100% { box-shadow: inset 0 0 10px rgba(0,0,0,0.5), 0 0 8px rgba(155, 89, 182, 0.15); }
    50% { box-shadow: inset 0 0 12px rgba(0,0,0,0.55), 0 0 16px rgba(155, 89, 182, 0.45); }
}

@keyframes glowGold {
    0%, 100% { box-shadow: inset 0 0 10px rgba(0,0,0,0.5), 0 0 8px rgba(241, 196, 15, 0.15); }
    50% { box-shadow: inset 0 0 12px rgba(0,0,0,0.55), 0 0 18px rgba(241, 196, 15, 0.5); }
}

.item-slot:hover {
    border-color: #8b6914;
    background: linear-gradient(135deg, #3a2a1f 0%, #2a1f15 100%);
    transform: translateY(-2px);
    box-shadow: 
        inset 0 0 10px rgba(0, 0, 0, 0.5),
        0 4px 8px rgba(139, 105, 20, 0.4);
}

.item-slot:active {
    transform: translateY(0);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
}

/* 物品介绍气泡 */
.item-tooltip {
    position: fixed;
    max-width: 260px;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    border: 2px solid #8b6914;
    border-radius: 6px;
    padding: 10px 12px;
    z-index: 10050;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    animation: tooltipFade 120ms ease-out;
}

/* 详细子弹窗布局（图标、标题、属性列表） */
.item-tooltip__head {
    display: grid;
    grid-template-columns: 48px 1fr;
    grid-column-gap: 10px;
    align-items: start;
    margin-bottom: 8px;
}

.item-tooltip__icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 4px;
}

.item-tooltip__title {
    align-self: center;
}

.item-tooltip::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 16px;
    border-width: 8px 8px 0 8px;
    border-style: solid;
    border-color: #8b6914 transparent transparent transparent;
}

.item-tooltip__name {
    font-weight: bold;
    color: #f4d03f;
    margin-bottom: 6px;
}

.item-tooltip__list {
    margin-top: 6px;
}

.item-tooltip__row {
    display: flex;
    font-size: 12px;
    line-height: 1.6;
}

.item-tooltip__label {
    color: #f4d03f;
    min-width: 56px;
}

.item-tooltip__value {
    color: #eee;
}

.item-tooltip__desc {
    font-size: 12px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
}

.item-tooltip__meta {
    margin-top: 8px;
    font-size: 12px;
    color: #ddd;
}

@keyframes tooltipFade {
    from { opacity: 0; transform: translateY(2px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 物品图标 */
.item-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    line-height: 1;
}

.item-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* 物品名称 - 中下方 */
.item-name {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    text-shadow: 
        1px 1px 2px rgba(0, 0, 0, 0.8),
        0 0 4px rgba(0, 0, 0, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
    z-index: 2;
}

/* 名称颜色随稀有度变化 */
.item-slot.rarity-white .item-name { color: #ffffff; }
.item-slot.rarity-green .item-name { color: #2ecc71; }
.item-slot.rarity-purple .item-name { color: #9b59b6; }
.item-slot.rarity-gold .item-name { color: #f1c40f; }

/* 物品数量 - 右下角 */
.item-count {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #8b6914;
    border-radius: 3px;
    padding: 2px 6px;
    color: #f4d03f;
    font-size: 11px;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
    z-index: 3;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* 空槽位提示 */
.item-slot.empty {
    opacity: 0.4;
    cursor: default;
}

.item-slot.empty:hover {
    transform: none;
    border-color: #5a4528;
}

/* 滚动条样式 - 魔兽风格 */
.backpack-body::-webkit-scrollbar {
    width: 10px;
}

.backpack-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
}

.backpack-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #8b6914 0%, #6d5210 100%);
    border-radius: 5px;
    border: 1px solid #5a4528;
}

.backpack-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #a67c1a 0%, #8b6914 100%);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .backpack-container {
        min-width: 90vw;
        max-height: 85vh;
    }

    .backpack-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .backpack-title {
        font-size: 18px;
    }

    .close-btn {
        width: 28px;
        height: 28px;
        font-size: 20px;
    }

    .item-icon {
        width: 40px;
        height: 40px;
        font-size: 28px;
    }

    .item-name {
        font-size: 11px;
        bottom: 18px;
    }

    .item-count {
        font-size: 10px;
        padding: 1px 5px;
    }
}

/* 手机横屏优化 */
@media (max-height: 600px) and (orientation: landscape) {
    .backpack-body {
        padding: 15px;
        max-height: calc(90vh - 60px);
    }

    .backpack-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 8px;
    }

    .item-icon {
        width: 36px;
        height: 36px;
        font-size: 24px;
    }

    .item-name {
        font-size: 10px;
        bottom: 16px;
    }

    .item-count {
        font-size: 9px;
    }
}

